package generator.engine.parse.impl;

import generator.engine.parse.ClassInfoParser;
import generator.entity.ClassInfo;
import generator.util.TableParseUtil;

import java.io.IOException;

/**
 * @author chengsp
 * @date 2019/10/19 15:21
 */
public class TableSqlClassInfoParser implements ClassInfoParser {
    private String tableSql;

    public TableSqlClassInfoParser(String tableSql) {
        this.tableSql = tableSql;
    }

    @Override
    public ClassInfo parseClassInfo() {
        try {
            return TableParseUtil.processTableIntoClassInfo(tableSql);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public String type() {
        return "tableSql";
    }
}
